home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / dev / c / ctags.lha / ctags-3.0.3 / configure.in < prev    next >
Text File  |  1999-02-17  |  6KB  |  253 lines

  1. dnl $Id: configure.in,v 7.3 1998/12/21 03:37:17 darren Exp $
  2.  
  3. dnl    Copyright (c) 1996-1998, Darren Hiebert
  4. dnl
  5. dnl    This source code is released for free distribution under the terms
  6. dnl    of the GNU General Public License.
  7.  
  8. dnl    Process this file with autoconf to produce a configure script.
  9.  
  10. AC_PREREQ(1.12)
  11. AC_INIT(ctags.h)
  12. AC_CONFIG_HEADER(config.h)
  13.  
  14. dnl Report system info
  15. dnl ------------------
  16. uname -mrsv 2>/dev/null
  17.  
  18. dnl Define convenience macros
  19. dnl -------------------------
  20. dnl CHECK_HEADER_DEFINE(LABEL, HEADER [,ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ] ])
  21. AC_DEFUN(CHECK_HEADER_DEFINE,
  22. [
  23.     AC_MSG_CHECKING("if $1 is defined in $2")
  24.     AC_EGREP_CPP(yes,
  25. [#include <$2>
  26. #ifdef $1
  27.   yes
  28. #endif
  29. ], [
  30.     AC_MSG_RESULT(yes)
  31.     $3
  32. ], [
  33.     AC_MSG_RESULT(no)
  34.     $4
  35. ]) ])
  36.  
  37. dnl Checks for configuration options
  38. dnl --------------------------------
  39.  
  40. AC_ARG_ENABLE(etags,
  41.     [  --disable-etags         disable the installation of links for etags],,
  42.     enable_etags=yes)
  43.  
  44. AC_ARG_ENABLE(external-sort,
  45. [  --disable-external-sort use internal sort algorithm instead of system sort
  46.                           utility],,
  47.     enable_external_sort=yes)
  48.  
  49. AC_ARG_ENABLE(macro-patterns,
  50. [  --enable-macro-patterns use patterns as default method to locate macros
  51.                           instead of line numbers])
  52.  
  53. AC_ARG_ENABLE(maintainer-mode,
  54. [  --enable-maintainer-mode
  55.                           use maintainer makefile])
  56.  
  57. AC_ARG_ENABLE(extended-format,
  58. [  --disable-extended-format
  59.                           disable extension flags; use original ctag file
  60.                           format only],
  61.     AC_DEFINE(DEFAULT_FILE_FORMAT, 1), AC_DEFINE(DEFAULT_FILE_FORMAT, 2))
  62.  
  63.  
  64. dnl Process configuration options
  65. dnl -----------------------------
  66.  
  67. if test "$enable_maintainer_mode" = yes ;then
  68.     AC_MSG_RESULT(enabling maintainer mode)
  69. fi
  70.  
  71. if test "$enable_etags" = yes ;then
  72.     install_targets="install-ctags install-etags"
  73.     AC_MSG_RESULT(links for etags will be installed)
  74. else
  75.     install_targets="install-ctags"
  76.     AC_MSG_RESULT(do not install links for etags)
  77. fi
  78. AC_SUBST(install_targets)
  79.  
  80. if test "$enable_macro_patterns" = yes ;then
  81.     AC_DEFINE(MACROS_USE_PATTERNS)
  82.     AC_MSG_RESULT(tag file will use patterns for macros by default)
  83. fi
  84.  
  85. if test "$enable_external_sort" = yes; then
  86.     enable_external_sort=no
  87.     AC_CHECK_PROG(sort_found, sort, yes, no)
  88.     if test "$sort_found" = yes; then
  89.         AC_MSG_CHECKING(whether sort accepts our command line)
  90.         touch /tmp/sort.test
  91.         sort -u -o /tmp/sort.test /tmp/sort.test 1>/dev/null 2>&1
  92.         if test $? -ne 0; then
  93.             AC_MSG_RESULT(no)
  94.         else
  95.             AC_MSG_RESULT(yes)
  96.             AC_PROG_AWK
  97.             if test -z "$AWK"; then
  98.                 AC_MSG_RESULT(no awk found)
  99.             else
  100.                 AC_DEFINE_UNQUOTED(AWK, "$AWK")
  101.                 AC_DEFINE(EXTERNAL_SORT)
  102.                 AC_MSG_RESULT(using external sort utility)
  103.                 enable_external_sort=yes
  104.             fi
  105.         fi
  106.         rm -f /tmp/sort.test
  107.     fi
  108. fi
  109. if test "$enable_external_sort" != yes; then
  110.     AC_MSG_RESULT(using internal sort algorithm)
  111. fi
  112.  
  113.  
  114. dnl Checks for programs
  115. dnl -------------------
  116.  
  117. AC_PROG_CC
  118. AC_PROG_LN_S
  119. AC_CHECK_PROG(STRIP, strip, strip, :)
  120.  
  121.  
  122. dnl Checks for header files
  123. dnl -----------------------
  124.  
  125. AC_CHECK_HEADERS(dirent.h stdlib.h time.h unistd.h)
  126. AC_CHECK_HEADERS(sys/dir.h sys/stat.h sys/times.h sys/types.h)
  127.  
  128.  
  129. dnl Checks for header file macros
  130. dnl -----------------------------
  131.  
  132. CHECK_HEADER_DEFINE(L_tmpnam, stdio.h,, AC_DEFINE(L_tmpnam, 20))
  133.  
  134. CHECK_HEADER_DEFINE(INT_MAX, limits.h,,
  135.     CHECK_HEADER_DEFINE(MAXINT, limits.h,
  136.         AC_DEFINE(INT_MAX, MAXINT), AC_DEFINE(INT_MAX, 32767)))
  137.  
  138.  
  139. dnl Checks for typedefs
  140. dnl -------------------
  141.  
  142. AC_TYPE_SIZE_T
  143. AC_TYPE_OFF_T
  144.  
  145. AC_MSG_CHECKING("for fpos_t")
  146. AC_EGREP_HEADER(fpos_t, stdio.h, AC_MSG_RESULT(yes),
  147. [
  148.     AC_MSG_RESULT(no)
  149.     AC_DEFINE(fpos_t, long)
  150. ])
  151.  
  152. AC_MSG_CHECKING("for clock_t")
  153. AC_EGREP_HEADER(clock_t, time.h, AC_MSG_RESULT(yes),
  154. [
  155.     AC_MSG_RESULT(no)
  156.     AC_DEFINE(clock_t, long)
  157. ])
  158.  
  159.  
  160. dnl Checks for compiler characteristics
  161. dnl -----------------------------------
  162.  
  163. AC_C_CONST
  164.  
  165.  
  166. dnl Checks for library functions
  167. dnl ----------------------------
  168.  
  169. AC_REPLACE_FUNCS(strstr)
  170.  
  171. AC_CHECK_FUNCS(fgetpos, have_fgetpos=yes)
  172.  
  173. dnl SEEK_SET should be in stdio.h, but may be in unistd.h on SunOS 4.1.x
  174. if test "$have_fgetpos" != yes; then
  175.     CHECK_HEADER_DEFINE(SEEK_SET, stdio.h,,
  176.         CHECK_HEADER_DEFINE(SEEK_SET, unistd.h,,
  177.             AC_DEFINE(SEEK_SET, 0)))
  178. fi
  179.  
  180. AC_CHECK_FUNCS(strerror opendir)
  181. AC_CHECK_FUNCS(clock times, break)
  182. AC_CHECK_FUNCS(remove, have_remove=yes,
  183.     CHECK_HEADER_DEFINE(remove, unistd.h,, AC_DEFINE(remove, unlink)))
  184.  
  185. AC_CHECK_FUNCS(truncate, have_truncate=yes)
  186. dnl === Cannot nest AC_CHECK_FUNCS() calls
  187. if test "$have_truncate" != yes ;then
  188.     AC_CHECK_FUNCS(ftruncate, have_ftruncate=yes)
  189.     if test "$have_ftruncate" != yes ;then
  190.         AC_CHECK_FUNCS(chsize)
  191.     fi
  192. fi
  193.  
  194. AC_CHECK_FUNCS(putenv, have_putenv=yes)
  195. dnl === Cannot nest AC_CHECK_FUNCS() calls
  196. if test "$have_putenv" != yes ;then
  197.     AC_CHECK_FUNCS(setenv)
  198. else
  199.     AC_EGREP_HEADER(putenv, stdlib.h, have_putenv_prototype=yes)
  200.     if test "$have_putenv_prototype" = yes ;then
  201.         AC_MSG_CHECKING("putenv prototype")
  202.         AC_EGREP_HEADER([[^A-Za-zo-9_]putenv[     ]*\(.*const.*\)[     ]*;],
  203.             stdlib.h, AC_MSG_RESULT(correct),
  204.             [
  205.                 AC_MSG_RESULT(no const)
  206.                 AC_DEFINE(NON_CONST_PUTENV_PROTOTYPE)
  207.             ])
  208.     fi
  209. fi
  210.  
  211.  
  212. dnl Checks for missing prototypes
  213. dnl -----------------------------
  214. AC_CHECKING("for missing prototypes")
  215.  
  216. AC_DEFUN(CHECK_PROTO, [AC_EGREP_HEADER([[^A-Za-z0-9_]$1([     ]+[A-Za-z0-9_]*)?\(.*\)[     ]*;], $2,, AC_DEFINE(patsubst([NEED_PROTO_NAME], [NAME], translit($1, [a-z], [A-Z]))) AC_MSG_RESULT(adding prototype for $1))])
  217.  
  218. if test "$have_remove" = yes; then
  219.     CHECK_PROTO(remove, stdio.h)
  220. else
  221.     CHECK_PROTO(unlink,    unistd.h)
  222. fi
  223. CHECK_PROTO(malloc,    stdlib.h)
  224. CHECK_PROTO(getenv,    stdlib.h)
  225. CHECK_PROTO(strstr,    string.h)
  226. CHECK_PROTO(stat,    sys/stat.h)
  227. if test "$have_fgetpos" = yes; then
  228.     CHECK_PROTO(fgetpos, stdio.h)
  229. fi
  230. if test "$have_truncate" = yes; then
  231.     CHECK_PROTO(truncate, unistd.h)
  232. fi
  233. if test "$have_ftruncate" = yes; then
  234.     CHECK_PROTO(ftruncate, unistd.h)
  235. fi
  236.  
  237.  
  238. dnl Output files
  239. dnl ------------
  240.  
  241.  
  242. rm -f Makefile
  243. if test "$enable_maintainer_mode" = yes ;then
  244.     AC_MSG_RESULT(creating maintainer Makefile)
  245.     ln -s Makefile.maint Makefile
  246.     makefile_out=
  247. else
  248.     makefile_out=Makefile
  249. fi
  250. AC_OUTPUT($makefile_out)
  251.  
  252. dnl vim:ts=4:sw=4:
  253.